//
//  FavoriteButton.swift
//  Landmarks
//
//  Created by apple on 2024/5/28.
//  Copyright © 2024 pc. All rights reserved.
//

import SwiftUI

struct FavoriteButton: View {
    @Binding var isSet:Bool?
    
    var body: some View {
        Button(action: {
            if isSet != nil {
                isSet!.toggle()
            }
            else{
                isSet = true
            }
        }, label: {
            Label("Toggle Favorite",systemImage: isSet == true ? "star.fill" : "star")
                .labelStyle(.iconOnly)
                .foregroundStyle(isSet == true ? .yellow : .gray)
        })
    }
}


#Preview {
    FavoriteButton(isSet: .constant(true))
}
